package com.yqy.spring.biz;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;
@Aspect
@Component
public class TransactionAspect {
    @Around("execution(* com.yqy.spring.biz..*(..))")
    public void aroundAdvice(ProceedingJoinPoint proceedingJoinPoint){
        try {
            System.out.println("开启事务~");
            proceedingJoinPoint.proceed();
            System.out.println("提交事务~\n————————————————");
        } catch (Throwable e) {
            System.out.println("回滚事务~");
        }
    }
}
